package com.jasmine.auth;

import com.jasmine.auth.interceptor.AuthInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.PostConstruct;

/**
 * @author jasmineXz
 */
public class AuthMvcConfig implements WebMvcConfigurer {
    private static final Logger log = LoggerFactory.getLogger(AuthMvcConfig.class);

    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor).addPathPatterns("/**");
    }

    @PostConstruct
    public void init() {
        log.info("[BJSTK] [AUTH] AuthMvcConfig Initialization completed");
    }


}
